<template>
	<view class="my-content">
		<view class="balance-item" v-for="item in logList">
			<view class="balance-title">
				<text class="big" v-if="type==0">{{ item.memo }}   
					<block v-if="item.lx==2">
						<text v-if="item.status==1" style="color: red;">（已打款）</text><text v-if="item.status!=1">（打款中）</text>
					</block>
				</text>
				<text class="big" v-if="type==1">结算</text>
				
				<text>{{ item.create_at }}</text>
			</view>
			<text> 
				<text v-if="item.lx==0">+</text><text v-if="item.lx!=0">-</text> {{ Number(item.amount).toFixed(2) }}
				
			</text>
		</view>
		<Nomore v-if="logList.length == 0"></Nomore>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				logList:[],
				type:0
			}
		},
		async onLoad(option) {
			if(option.type){
				this.type = option.type
			}
			console.log(option)
			if(this.type==0){
				await this.getLogList()
			}else{
				await this.getLogList2()
			}
		},
		methods: {
			async getLogList(){
				uni.showLoading({
					title: "加载中"
				})
				const res = await this.http("get", "/api/user/user_money_log")
				uni.hideLoading()
				this.logList = res.data
			},
			async getLogList2(){
				uni.showLoading({
					title: "加载中"
				})
				const res = await this.http("get", "/api/user/user_money_log2")
				uni.hideLoading()
				this.logList = res.data
			}
		}
	}
</script>

<style lang="less" scoped>
	.my-content{
		width: 100%;
		padding: 30upx;
		box-sizing: border-box;
		.balance-item{
			width: 100%;
			background-color: #fff;
			box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.3);
			border-radius: 16upx;
			margin-bottom: 20upx;
			padding: 20upx;
			box-sizing: border-box;
			.balance-title{
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 20upx;
				.big{
					font-size: 36upx;
					color: #000;
					font-weight: bold;
				}
				text{
					color: #A6A6A6;
					font-size: 24upx;
				}
			}
			text{
				font-size: 32upx;
				color: #A6A6A6;
			}
		}
	}
</style>